package model;


class ALU extends FunctionalUnit {
	
	public ALU(Pipe sourcePipe, Pipe destinationPipe) {
		super(sourcePipe, destinationPipe);
	}
	
	private int a,b;
	
	public void execute1() {
		a = getPipeData("BASE");
		b = getPipeData("OFFSET");
		Facade.getInstance().move(UnitEnum.Pipe2, UnitEnum.ALU, a);
		Facade.getInstance().move(UnitEnum.Pipe2, UnitEnum.ALU, b);
	}
	
	@Override
	public void execute2() {
		setPipeData("ADDRESS", a + b );
		Facade.getInstance().move(UnitEnum.ALU, UnitEnum.Pipe3, a + b);
	}
	
}
